package com.android.wineshop;

import java.util.ResourceBundle.Control;

import com.android.controller.Customer_Controller;
import com.android.entity.Customer;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class CustomerDetail extends Activity {
	TextView customer_name;
	TextView password;
	TextView fullname;
	TextView birthday;
	TextView address;
	TextView phone;
	TextView email;
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.customer_detail);
        
        customer_name = (TextView)findViewById(R.id.txtCustomerName);
        password = (TextView)findViewById(R.id.txtPassword);
        fullname = (TextView)findViewById(R.id.txtCustomerFullName);
        birthday = (TextView)findViewById(R.id.txtBirthday);
        address = (TextView)findViewById(R.id.txtAddress);
        phone = (TextView)findViewById(R.id.txtPhone);
        email = (TextView)findViewById(R.id.txtEmail);
        
        Bundle customer_data = getIntent().getExtras();
        String cust_name = customer_data.getString("cust_name");
        
        
        Customer customer = new Customer();

        customer = Customer_Controller.getCustomerByName(cust_name);
        
        
        String cCustName = customer.getCustomer_name().toString();
        customer_name.setText(cCustName);
        
        String cPass = customer.getPassword().toString();
        password.setText(cPass);
        
        String cFullname = customer.getNames().toString();
        fullname.setText(cFullname);
        
        String cBirthday = customer.getDataOfBirth().toString();
        birthday.setText(cBirthday);
        
        String cAddress = customer.getAddress().toString();
        address.setText(cAddress);
        
        String cPhone = customer.getPhone().toString();
        phone.setText(cPhone);
        
        String cEmail = customer.getEmail().toString();
        email.setText(cEmail);
        
	}
}
